const AutoImport = require('unplugin-auto-import/webpack');
const Components = require('unplugin-vue-components/webpack');
const { ElementPlusResolver } = require('unplugin-vue-components/resolvers');
module.exports = {
  publicPath:
    process.env.NODE_ENV === 'production' ? '/bim-management-platform' : './',
  configureWebpack: {
    resolve: {
      alias: {
        components: '@/components'
      }
    },
    plugins: [
      AutoImport({
        resolvers: [ElementPlusResolver()]
      }),
      Components({
        resolvers: [ElementPlusResolver()]
      })
    ],
    module: {
      rules: [
        {
          // test: /\.wasm$/,
          // use: ['wasm-loader']
        }
      ]
    },
    devServer: {
      // proxy: {
      //   '/api': {
      //     target: 'http://152.136.185.210:5000',
      //     pathRewrite: {
      //       '^/api': ''
      //     },
      //     //绕过对请求头的校验
      //     changeOrigin: true
      //   }
      // }
      open: true, // 设置是否自动打开浏览器
      hotOnly: true // 是否开启热更新
    }
  },
  chainWebpack: (config) => {
    config.plugin('html').tap((args) => {
      args[0].title = '这是标题';
      return args;
    });
  }
};
